#!/bin/bash
ps aux |grep shr25-qq-robot.jar |grep -v "grep" >/dev/null
if [ $? -eq 0 ];then
  echo "qq-robot is running"
  shrzhrpid=$(ps aux |grep shr25-qq-robot.jar |grep -v "grep"|awk '{print $2}')
  if [ x"$shrzhrpid" != x ]; then
	kill -9 $shrzhrpid
  fi
  echo "shr25-qq-robot already stoped"
else
  echo "shr25-qq-robot is stoped"
fi

SOURCE="$0"
while [ -h "$SOURCE"  ]; do # resolve $SOURCE until the file is no longer a symlink
    DIR="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"
    SOURCE="$(readlink "$SOURCE")"
	echo $SOURCE
    [[ $SOURCE != /*  ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
curPath="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"

java -Dloader.path=$curPath/lib -Dspring_profiles_active=prod -jar $curPath/shr25-qq-robot.jar &
